﻿<Window x:Class="Test.Window6"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:gi="clr-namespace:GreyableImage;assembly=GreyableImage"
        Title="Window6"
        Height="600"
        Width="1024">

  <DockPanel>
    <DockPanel DockPanel.Dock="Top" Margin="3">
      <TextBlock DockPanel.Dock="Left" Text="ImageSource: " VerticalAlignment="Center"/>
      <Button DockPanel.Dock="Right" Content=" . . . " Click="OnClickBrowse" />
      <TextBox Text="{Binding ImageSource}" Margin="10,0"/>
    </DockPanel>
    
    <ToolBar DockPanel.Dock="Top">
      <CheckBox Content="Greyable" x:Name="tbGreyable" Margin="0,0,2,0" IsChecked="True"/>
      <CheckBox Content="Enable" IsChecked="True" x:Name="tbEnabled" Margin="0,0,2,0" />
    </ToolBar>

    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition/>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
      </Grid.ColumnDefinitions>

      <!-- Titles -->
      <Border Grid.Row="0" Grid.Column="0" BorderBrush="Gray" BorderThickness="0,1,1,1">
        <TextBlock Text="Using Image Greyer" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>
      </Border>
      <Border Grid.Row="0" Grid.Column="1" BorderBrush="Gray" BorderThickness="0,1,0,1">
        <TextBlock Text="Using GreyableImage" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>
      </Border>
      
      <!-- Images -->
      <Border Grid.Row="1" Grid.Column="0" BorderBrush="Gray" BorderThickness="0,0,1,0">
        <Image Source="{Binding ImageSource}"
               HorizontalAlignment="Center" VerticalAlignment="Center"
               Stretch="None"
               IsEnabled="{Binding ElementName=tbEnabled, Path=IsChecked}"
               gi:ImageGreyer.IsGreyable="{Binding ElementName=tbGreyable, Path=IsChecked}"/>
      </Border>
      <Border Grid.Row="1" Grid.Column="1" BorderBrush="Gray" BorderThickness="0">
        <gi:GreyableImage Source="{Binding ImageSource}"
                          HorizontalAlignment="Center" VerticalAlignment="Center"
                          Stretch="None"
                          IsEnabled="{Binding ElementName=tbEnabled, Path=IsChecked}"/>
      </Border>
      
    </Grid>

  </DockPanel>
</Window>
